$(document).ready(function(){
      var searchInfo={
          select:""//关键词
      }
			var table=$("#dictTable");
			var t=table.dataTable({
          "ajax":function(data,callback,setting){
          var page = table.api().page.info();
          $.post("/index.php?m=Admin&c=Dict&a=search",{pageIndex:page.page+1,pageSize:page.length,select:searchInfo.select},function(data,status){
            console.log(data);
              callback(data); 
          });
         },
          // "ajax":{
          //     "url":'/index.php?m=Admin&c=SystemConfig&a=index',
          //     "type":'POST',
          //     "data":{
          //         pageIndex:0,
          //         pageSize:10
          //     }
          // },
 				 "pageLength":10,
  			 "ordering":false,
         "deferRender": true,
  				"columns":[
  				{"data":"id"},
  				{"data":"id"},
  				{"data":"keyword"},
  				{"data":"type"},//小区地址
  				{"data":"text"},
  				{"data":"value"},//物业情况
  				{"data":"sort"},//下辖园区
  				{"data":"id"},
  				],
  				"columnDefs":[
  				{
  					"targets":0,
  					"data":"id",
  					"render":function(data,type,full,meta){
  						return '<input type="checkbox" value="'+data+'" name="dict_id">';
  					}

  				},
  				{
  					"targets":7,
  					"data":"id",
  					"render":function(data,type,full,meta){
  						var poStr='<a title="编辑" href="javascript:;" uid="'+data+'" class="ml-5 dictEdit" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a><a title="删除" href="javascript:;" uid="'+data+'" class="ml-5 dictDel uid-'+data+'" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>';
  						return poStr;
  					}

  				},
  				],
  			"fnCreatedRow":function(row,data,index){
  				//row 表示当前tr，data表示当前行的元素对象，index表示当前tr索引
  				
  			 },
			"bPaginate": true, //翻页功能
			// "processing": true,
      "searching":false,
      "serverSide": true,//服务器模式
        });
    $(".searchButton").click(function(){
      searchInfo.select=$("#searchName").val();
      t.api().draw();
    });
    // 回车事件
    document.onkeydown = function(e){
                 var ev = document.all ? window.event : e;
                 if(ev.keyCode==13) {
                  e.preventDefault();
                    searchInfo.select=$("#searchName").val();
                    t.api().draw();
                 }
    }
});